<?php
namespace App\Http\Controllers\Titles;
use Illuminate\Http\Request;
use App\Http\Controllers\BaseApiController;
use App\Services\Titles\TitlesService;


class TitlesController extends BaseApiController
{
    private $service;

    public function __construct(TitlesService $service)
    {
        //继承基类的构造方法
        parent::__construct();
        //依赖注入service
        $this->service = $service;
    }
    public function sel(Request $request)
    {
        $rule=['test_id' => 'required|integer|max:1000'];
        if($error=$this->validate($rule,$request))
        {
            return $error;
        }
        //根据类型去查询
        $data=$request->get("test_id");
        return $this->service->sel($data);
    }
}